package com.yuren.codecrushlearn.Q5200;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with Intellij IDEA.
 * Description:
 * Bruce Force算法
 * @author 10204
 * @date 2025-04-29 01:51
 */
public class Q5241 {
    public List<Integer> bf(String mstr, String sstr) {
        int n = mstr.length();
        int m = sstr.length();
        List<Integer> res = new ArrayList<>();
        for (int i = 0; i <= n - m; ++i) {
            int j = 0;
            while (j < m) {
                if (mstr.charAt(i + j) != sstr.charAt(j)) break;
                j++;
            }
            if (j == m) {
                res.add(i);
            }
        }

        return res;
    }
}
